package apibasej.server.db.to;

import apibasej.shared.util.UtilStrObj;
import apibasej.shared.xml.NodeXML;

@NodeXML
public class StatementParam<T> {

	@NodeXML private Integer type;
	@NodeXML(needType=true) private T value;
	
	public Integer getType() {
		return type;
	}
	public T getValue() {
		return value;
	}
	public void setType(Integer type) {
		this.type = type;
	}
	public void setValue(T value) {
		this.value = value;
	}
	 
	
	// para auxiliar nos logs
	public String getStrInfo(){
		StringBuilder sb = new StringBuilder();
		sb.append("PARAM=");
		if(getValue()==null) {
			sb.append("null");
		}else{
			String v = UtilStrObj.toStr(getValue());
			if(v.length()<=80) sb.append(v);
			else sb.append("[size:"+v.length()+"]");
		}
		sb.append('\n');
		return sb.toString();
	}
	
}
